package com.wqt;

/**
 * @ProjectName: ybxy6
 * @Titile: Student
 * @Author: wqt
 * @Description: TODO
 */

public class Student implements Comparable<Student> {
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    @Override
    public int compareTo(Student other) {
        // 按照年龄升序排列，也可改为姓名等
        return Integer.compare(this.age, other.age);
    }

    @Override
    public String toString() {
        return "Student{name='" + name + "', age=" + age + "}";
    }
}